package com.piece.blog.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 资源 training_resource
 *
 * @author onepiece
 * @date 2023-08-29
 */
@Data
@NoArgsConstructor
@Entity
@Table(name = "training_resource")
@ApiModel(value = "资源")
public class TrainingResource implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "resource_id", length = 11)
    @ApiModelProperty(value = "资源ID")
    private Long resourceId;

    @Column(name = "name")
    @ApiModelProperty(value = "资源名")
    private String name;

    @Column(name = "type")
    @ApiModelProperty(value = "类型")
    private String type;

    @Column(name = "file_id")
    @ApiModelProperty(value = "文件ID")
    private String fileId;

    @Transient
    @ApiModelProperty(value = "文件原始名称")
    private String fileName;

    @Column(name = "extension")
    @ApiModelProperty(value = "文件类型")
    private String extension;

    @Column(name = "size")
    @ApiModelProperty(value = "大小[字节]")
    private Long size;

    @Column(name = "duration")
    @ApiModelProperty(value = "时长[s]")
    private Long duration;

    @Column(name = "status")
    @ApiModelProperty(value = "状态（0有效 1无效）")
    private String status;

    @Column(name = "create_by")
    @ApiModelProperty(value = "创建人ID")
    private Long createBy;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

}
